package wnhz.com.business.shareshop.ui;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import wnhz.com.business.MyApplication;
import wnhz.com.business.R;
import wnhz.com.business.StartActivity;
import wnhz.com.business.base.MyBaseActivity;
import wnhz.com.business.groupshop.ui.PayActivity;
import wnhz.com.business.impl.ActionBarClickListener;
import wnhz.com.business.uitls.Base64Util;
import wnhz.com.business.uitls.MyCallBack;
import wnhz.com.business.uitls.Url;
import wnhz.com.business.uitls.XUtil;
import wnhz.com.business.view.TranslucentActionBar;

/**
 * 我的钱包——充值
 */
public class RechargeActivityS extends MyBaseActivity implements ActionBarClickListener,View.OnClickListener {

    @BindView(R.id.actionbar)
    TranslucentActionBar actionbar;
    @BindView(R.id.ll_choose)
    LinearLayout llChoose;
    @BindView(R.id.edt_moneypl)
    EditText edtMoneypl;
    @BindView(R.id.tv_makeok)
    TextView tvMakeok;
private  String way="1";

    public static Intent createIntent(Context context) {
        Intent intent = new Intent(context, RechargeActivityS.class);
        return intent;
    }


    @Override
    protected void handleMsg(Message msg) {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recharges);
        ButterKnife.bind(this);

        actionbar.setData("充值", R.drawable.ic_lefft_white, null, 0, null, 0, this);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            actionbar.setStatusBarHeight(getStatusBarHeight());
        }

        initview();

    }

    private void initview()
    {

        llChoose.setOnClickListener(this);
        edtMoneypl.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void afterTextChanged(Editable editable) {
                tvMakeok.setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_circle_reds));
                tvMakeok.setTextColor(getResources().getColor(R.color.white));
                tvMakeok.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent intent = new Intent(RechargeActivityS.this,PayChongzhiActivity.class);
                        intent.putExtra("way",way);
                        intent.putExtra("amount",edtMoneypl.getText().toString());
                        startActivity(intent);
                    }
                });
            }
        });
    }

    @Override
    public void onLeftClick() {
        finish();
    }

    @Override
    public void onRightClick() {

    }

    @Override
    public void onEditTextClick() {

    }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.ll_choose:
                break;
        }
    }
}
